package com.heaven.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.heaven.pojo.Lead;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface LeadMapper extends BaseMapper {
    @Select("select * from lead where name like \"%\" #{query} \"%\" limit #{startNum},#{size}")
    List<Lead> addreList(@Param("size") int size,
                         @Param("startNum") int startNum,
                         @Param("query") String query);
    @Select("select count(*) from lead where name like \"%\" #{query} \"%\" ")
    long findAddreList(String query);

    @Delete("delete from lead where id=#{id}")
    void deleteLeadById(Integer id);

    @Select("select * from lead where id=#{id}")
    Lead findLeadById(Integer id);

    @Update("update lead set name=#{name},job=#{job},honor=#{honor}" +
            "where id=#{id}")
    void updateLead(Lead lead);
}
